package com.lagou.rpc.provider2.service;

import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.config.ZooConfig;
import com.lagou.rpc.pojo.User;
import com.lagou.rpc.provider2.anno.RpcService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@RpcService
@Service
public class UserServiceImpl implements IUserService {


    @Override
    public User getById(int id) {
        Map<Object, User> userMap = new HashMap();
        User user1 = new User();
        user1.setId(1);
        user1.setName("张三");
        user1.setIpAndport(ZooConfig.ip01 + "#" + ZooConfig.port01);
        User user2 = new User();
        user2.setId(2);
        user2.setName("李四");
        user2.setIpAndport(ZooConfig.ip01 + "#" + ZooConfig.port01);
        userMap.put(user1.getId(), user1);
        userMap.put(user2.getId(), user2);

        return userMap.get(id);
    }
}